package com.up360.rapidcalc.aerolite.scene
{
    import com.up360.rapidcalc.aerolite.AeroliteCrisis;
    import com.up360.rapidcalc.aerolite.swc.Home;
    
    import flash.events.MouseEvent;

    /**
     * @author Tunie
     * @date   May 3, 2013
     */
    public class HomePage extends Page
    {
        private var _ui:Home;
        public function HomePage()
        {
            super();
            _ui=new Home();
            //初始化界面
            init();
            addChild(_ui);
        }
        
        override public function init():void
        {
            super.init();
            //
            _ui.btnHelp.addEventListener(MouseEvent.CLICK,helpClick);
            _ui.btnStart.addEventListener(MouseEvent.CLICK,startClick);
        }
        
        override public function disruption():void
        {
            _ui.btnHelp.removeEventListener(MouseEvent.CLICK,helpClick);
            _ui.btnStart.removeEventListener(MouseEvent.CLICK,startClick);
            removeChild(_ui);
            //
            super.disruption();
        }
        
        /**
         * 帮助按钮单击后响应
         * @param event
         */
        private function helpClick(event:MouseEvent):void
        {
            trace("open help page!");
            var b_helpPage:HelperPage=new HelperPage(this);
            AeroliteCrisis.instance.addChild(b_helpPage);
        }
        
        /**
         * 开始按钮单击后响应
         * @param event
         */
        protected function startClick(event:MouseEvent):void
        {
            AeroliteCrisis.instance.start();
        }
        
    }
}